#pragma once
#include<iostream>
#include<queue>
#include<algorithm>
using namespace std;

#include<cstdlib>
#include<stdio.h>
#include<ctime>

#define QSIZE 100000

void tTest_Queue() {
	queue<string> q;
	char buf[10];

	clock_t timeStart = clock();
	cout << "开始时间: " << timeStart << endl;
	for (int i = 0; i < QSIZE; i ++) {
		try {
			snprintf(buf, 10, "%d", rand());
			q.push(buf);
		}
		catch (exception& p) {
			cout << "i= " << i << " " << p.what() << endl;
			abort();
		}
	}
	cout << "queue 赋值所需要时间: " << clock() - timeStart << endl;
	cout << "queue 大小: " << q.size() << endl;
	cout << "queue 起点元素: " << q.front() << endl;
	cout << "queue 终点元素: " << q.back() << endl;

	q.pop();	//取出元素
	cout << "queue pop后大小: " << q.size() << endl;
	cout << "queue pop后起点元素: " << q.front() << endl;
	cout << "queue pop后终点元素: " << q.back() << endl;
}